package tree;

public class MyTreeArray {
    public static void main(String[] args) {
        int[] a = {1,2,3,4,5,6,7};
        preOrderPrint(a);
    }

    private static void preOrderPrint(int[] a) {
        preOrder(a,0);
    }
    private static void preOrder(int[] a,int index) {
        System.out.println(a[index]);
        if(2*index+1<a.length){
            preOrder(a,2*index+1);
        }
        if(2*index+2<a.length){
            preOrder(a,2*index+2);
        }
    }
}
